<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>盒子模型练习</title>
        <style>
            .card{
                width: 300px;
                background-color: mediumspringgreen;
                padding: 10px;
                margin-bottom: 30px;
                /*切换为边框盒子模型，让卡片宽度为初设的300px*/
                box-sizing: border-box;
            }
            .card img{
                /* 图片的宽度为卡片宽度的100%，随卡片宽度改变 */
                width: 100%;
            }
            .card p{
                border: 5px solid darkturquoise;
                margin: 10px 20px 30px 40px;
                color: gray;
            }
        </style>
    </head>
    <body>
        <div class="card">
            <img src="img/1.png" alt="想看就自己去搜">
            <p><b>我是文字</b></p>
        </div>
        <div class="card">
            <img src="img/1.png" alt="想看就自己去搜">
            <p><b>我是文字</b></p>
        </div>
    </body>
</html>